var checkConnection = function(callback) {
    $.getJSON("/accounts/settings/sync_sns/status/?v=2", function(data){
        eval(callback)(data);
    });
};

var connect = function(sns_type, opts) {
    var opts = opts == undefined? {}: opts;
    if(sns_type == "sina") {
        sns_type = "sina2";
    }
    var callback = opts.callback
    var url = "/accounts/settings/sync_sns/connect_" + sns_type
        + "/?display=mobile&callback=" + escape(callback + "&sns_type=" + sns_type);
    window.location.href=url;
};

var share = function(sns_type, text, photo) {
    $.ajax({
        type: "POST",
        url: "/sns_share/",
        data: {
            csrfmiddlewaretoken: $("#csrf-token").val(),
            sns_type: sns_type,
            text: text,
            photo: photo},
        success: function(resp) {
        }
    })
};
